﻿using RuoVea.Entity;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using RuoVea.Api.Controllers;
using RuoVea.Service;

namespace RuoVea.Core.Service
{
    /// <summary>
    /// 职位服务
    /// </summary>
    public class SysPosController : ApiBaseController
    {
        private readonly ISysPosService _sysPosService;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sysPosService"></param>
        public SysPosController(ISysPosService sysPosService)
        {
            _sysPosService = sysPosService;
        }

        /// <summary>
        /// 分页获取职位
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet("page")]
        public async Task<dynamic> QueryPosPageList([FromQuery] PosInput input)
        {
            return await _sysPosService.QueryPosPageList(  input);
        }

        /// <summary>
        /// 获取职位列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("list")]
        public async Task<dynamic> GetPosList([FromQuery] PosInput input)
        {
            return await _sysPosService.GetPosList(input);
        }

        /// <summary>
        /// 增加职位
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("add")]
        public async Task AddPos(AddPosInput input)
        {
              await _sysPosService.AddPos(input);
        }

        /// <summary>
        /// 删除职位
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("delete")]
        public async Task DeletePos(DeletePosInput input)
        {
              await _sysPosService.DeletePos(input);
        }

        /// <summary>
        /// 更新职位
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("edit")]
        public async Task UpdatePos(UpdatePosInput input)
        {
              await _sysPosService.UpdatePos(input);
        }

        /// <summary>
        /// 获取职位
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet("detail")]
        public async Task<SysPos> GetPos([FromQuery] QueryPosInput input)
        {
            return await _sysPosService.GetPos(input);
        }
    }
}
